import '../../../../resource/component/css/component_v2_pc.css?v=2020.0713.1500'
import '../common/common.scss';

import Vue from 'vue';

import { 
  Popover, 
  Table, TableColumn, 
  Dropdown, DropdownItem, DropdownMenu, 
  Checkbox, 
  Select, Option, 
  Pagination,
  Tooltip,
} from 'element-ui';

import StatsPopverIcon from '../common/StatsPopoverIcon.vue';
import StatsChartEmpty from '../common/StatsChartEmpty.vue';
import StaffEfficiencyView from './StaffEfficiencyView.vue'
import Loading from 'packages/BaseLoading';
import DatePicker from '../common/DataTime.vue'


import Platform from '@src/util/platform.ts';
import filters from '@src/filter/filter';

import * as mtracker from '../../../util/Mtrackers';

import { isOpenData } from '@src/util/platform';
import platformExtension from '@src/platform/extension'

mtracker.initializeTalkingData();

Vue.component(Popover.name, Popover);
Vue.component(DatePicker.name, DatePicker)
Vue.component(Table.name, Table);
Vue.component(TableColumn.name, TableColumn);
Vue.component(Dropdown.name, Dropdown);
Vue.component(DropdownItem.name, DropdownItem);
Vue.component(DropdownMenu.name, DropdownMenu);
Vue.component(Checkbox.name, Checkbox);
Vue.component(Select.name, Select);
Vue.component(Option.name, Option);
Vue.component(Pagination.name, Pagination);
Vue.component(Tooltip.name, Tooltip);

Vue.component(StatsPopverIcon.name, StatsPopverIcon);
Vue.component(StatsChartEmpty.name, StatsChartEmpty);

for(let name in filters) Vue.filter(name, filters[name]);

Vue.prototype.$platform = Platform;
Vue.prototype.$loading = Loading;
Vue.prototype.$tdOnEvent = mtracker.onEvent;

// 微信配置
// if (window.wx || isOpenData) {
//   platformExtension.sign()
// }

Vue.component('async-component', function(resolve) {
  if (!window.wx && !isOpenData) {
    resolve(StaffEfficiencyView)
    return
  }
  platformExtension.sign().then(result => {
    resolve(StaffEfficiencyView)
  }).catch(error => {
    console.error(error)
  })
});

const app = {
  render(h) {
    return <async-component />
  }
}

export default app;